hello guys i'm new how you see
i have problem with my code
what i need to do is this
if i input letter 'g'
a
ccc
eeeee
ggggggg
it need to be all letters a,c,e,g,j jumping by 2
and my pyramid
Code:
#include <stdio.h>
void main() {
char letter;
int row;
int spaces;
int i;
int j ;
int k ;
printf("Please enter a letter:\n");
scanf("%c", &letter);
if ((letter < 'a' && letter < 'z') && (letter% 2 == 1)) {
printf("Invalid Input\n");
}
else
for (row = 'a'; row <= letter; row ++) {
for (spaces = letter; spaces > row; spaces--) // making space between letters
printf(" ");
}
for (k = 0; k < 2 * (i = 0); k++) {
printf("%c", letter);
}
letter = letter + 2;
printf("\n");
}
i get into infinty loop every time
tnx for help